package org.skipper.samples.rpc.server;

import org.skipper.rpc.server.Server;
import org.skipper.rpc.server.ServerCenter;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author shoujian
 * Date: 2021-09-24
 * Time: 上午10:43
 */
public class RPCServer {

    public static void main(String[] args) {
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                try {
//                    Server serviceServer = new ServerCenter(8080);
//                    serviceServer.register(HelloService.class, HelloServiceImpl.class);
//
//                    serviceServer.start();
////                    System.out.println(serviceServer.getPort());
////
////
////                    serviceServer.stop();
//
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//            }
//        }).start();


        Server serviceServer = new ServerCenter(8080);
        serviceServer.register(HelloService.class, HelloServiceImpl.class);

        try {
            serviceServer.start();
        } catch (IOException e) {
            e.printStackTrace();
        }


        try {
            Thread.sleep(100000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
